﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowUserStory.aspx.cs"
    Inherits="Actuals.ShowUserStory" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <link href="~/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <title>UserStory</title>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">


        function ShowAddUserStory() {
            var taskId = document.getElementById("ddlTask").value;
            var url = 'AddUserStory.aspx?Mode=Add&TaskId=' + taskId;
            var result = window.showModalDialog(url, this,
                'dialogHeight:290px;dialogWidth:255px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }

        function UpdateAddUserStory(userStoryId) {

            var taskId = document.getElementById("ddlTask").value;
            var url = 'AddUserStory.aspx?Mode=Edit&UserStoryId=' + userStoryId + '&TaskId=' +taskId;
           
            var result = window.showModalDialog(url, this, 'dialogHeight:290px;dialogWidth:255px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }




        function TestCheckBox() {
            debugger;
            var Target = null;
            Target = document.getElementById('<% = this.gvResults.ClientID %>');
            if (Target == null) {
                alert("No record is selected.Please select!");
                return false;
            }
            var Inputs = Target.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                    return confirm("Do you want to Delete?");
                }

            }
            alert("no record is selected.Please select!");
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div id="divUserStory" runat="server">
            <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
            <table width="100%">
                <tr>
                    <td width="10%">
                        <asp:Label ID="lblProject" runat="server" CssClass="label">Project</asp:Label>
                    </td>
                    <td width="90%" align="left">
                        <asp:DropDownList ID="ddlProject" runat="server" CssClass="textfield" AutoPostBack="true"
                            OnSelectedIndexChanged="ddlProject_OnSelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblRelease" runat="server" CssClass="label">Release</asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlRelease" runat="server" CssClass="textfield " AutoPostBack="true"
                            OnSelectedIndexChanged="ddlRelease_OnSelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblTask" runat="server" CssClass="label">Task
                        </asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList Width="75%" ID="ddlTask" runat="server" CssClass="textfield">
                        </asp:DropDownList>
                        <asp:Button ID="btngetUserStory" runat="server" Text="GetUserStory" OnClick="btnGetUserStory_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div runat="server" id="div1">
            <div id="div2" style="border: solid 1px silver; height: 520px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" AutoGenerateColumns="false" BorderColor="Black" runat="server"
                    AllowSorting="true" OnRowCommand="gvResults_OnRowCommand">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="chkShowUserStory" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblUserStoryId" runat="server" Text='<%# Bind("UserStoryId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="UserStoryDescription">
                            <ItemTemplate>
                                <asp:Label ID="lblUserStoryDescription" runat="server" Text='<%#Bind("UserStoryDescription") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Sprint">
                            <ItemTemplate>
                                <asp:Label ID="lblSprint" runat="server" Text='<%#getSprint(Eval("Sprint")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="StoryPoints">
                            <ItemTemplate>
                                <asp:Label ID="lblStoryPoints" runat="server" Text='<%#Bind("StoryPoints") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditUserStory" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "UserStoryId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>    
        <div>
                   <asp:Button ID="btnAddUserStory" runat="server" Text="AddUserStory" CssClass="button"
                OnClientClick="return ShowAddUserStory();" />
                <asp:Button ID="btnDelete" runat="server" CssClass="button" Text="Delete" OnClientClick="return TestCheckBox()"
            OnClick="btnDeleteUserStory_Click" />
        </div>
    </center>
    </form>
</body>
</html>
